CROSS=arm-linux-gnueabihf-
CC=$(CROSS)gcc
LD=$(CROSS)ld
OBJCOPY=$(CROSS)objcopy
OBJDUMP=$(CROSS)objdump


objs :=  start.o main.o

ledc.bin : $(objs)
	arm-linux-gnueabihf-ld -Timx6u.lds -o ledc.elf $^
	arm-linux-gnueabihf-objcopy -O binary -S ledc.elf ledc.bin
	arm-linux-gnueabihf-objdump -D -m arm ledc.elf > ledc.dis


%.o : %.c
	#arm-linux-gnueabihf-gcc -nostdlib -c -o $@ $<
	$(CC) -nostdlib -c -o $@ $<

%.o : %.s 
	#arm-linux-gnueabihf-gcc -nostdlib -c -o $@ $<
	$(CC) -nostdlib -c -o $@ $<


clean:
	rm -rf *.o ledc.bin ledc.elf ledc.dis
	rm -rf ledc.dis
	rm -rf load.imx
	
